package com.tqjc.system.C24012.core.wrapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.tqjc.system.C24012.common.constant.ConfigConstants;
import com.tqjc.system.C24012.common.entity.SysConfigEntity;
import com.tqjc.system.common.Wrapper.BaseWrapper;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: 86195
 * @CreateTime: 2024-07-16  09:49
 * @Description: TODO
 * @Version: 1.0
 */
public class ConfigInfoWrapper extends BaseWrapper<SysConfigEntity> {

    public ConfigInfoWrapper(IPage<SysConfigEntity> pageResult){
        super(pageResult);
        List<SysConfigEntity> records = pageResult.getRecords();
        List<SysConfigEntity> wrapperList = new ArrayList<SysConfigEntity>(records.size());
        for (SysConfigEntity record : records) {
            record.setConfigStatus(ConfigConstants.CONFIG_STATUS_EFFECTIVE.equals(record.getConfigStatus()) ?
                    ConfigConstants.CONFIG_EFFECTIVE_STR:ConfigConstants.CONFIG_UNEFFECTIVE_STR);
        }
        pageResult.setRecords(wrapperList);
    }
}
